
//
//  ActivityModel.m
//  ExcellentHome
//
//  Created by 揭婧雯 on 16/8/25.
//  Copyright © 2016年 陈区. All rights reserved.
//

#import "ActivityModel.h"

#define CHECKVALUE(A) (A) !=nil ? (A) : @""

@implementation ActivityModel

+ (instancetype)initWithDictionary:(NSDictionary*)dic
{
    id obj = [[self alloc] init];
    [obj setValuesForKeysWithDictionary:dic];
    [obj setValue:[dic objectForKey:@"description"] forKey:@"desc"];
    return obj;
}

- (void)setValue:(id)value forUndefinedKey:(NSString*)key
{
    
}

- (NSString*)description
{
    return [self getDictionaryFromModel].description;
}

- (NSDictionary *)getDictionaryFromModel
{
    NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
    [dict setObject:CHECKVALUE(_serviceId) forKey:@"serviceId"];
    [dict setObject:CHECKVALUE(_name) forKey:@"name"];
    [dict setObject:CHECKVALUE(_issuePerson) forKey:@"issuePerson"];
    [dict setObject:CHECKVALUE(_activityNum) forKey:@"activityNum"];
    [dict setObject:CHECKVALUE(_top) forKey:@"top"];
    [dict setObject:CHECKVALUE(_startDate) forKey:@"startDate"];
    [dict setObject:CHECKVALUE(_endDate) forKey:@"endDate"];
    [dict setObject:CHECKVALUE(_place) forKey:@"place"];
    [dict setObject:CHECKVALUE(_brief) forKey:@"brief"];
    [dict setObject:CHECKVALUE(_sellingPrice) forKey:@"sellingPrice"];
    [dict setObject:CHECKVALUE(_desc) forKey:@"desc"];
    [dict setObject:CHECKVALUE(_servicetypeId) forKey:@"servicetypeId"];
    [dict setObject:CHECKVALUE(_status) forKey:@"status"];
    [dict setObject:CHECKVALUE(_updateTime) forKey:@"updateTime"];
    [dict setObject:CHECKVALUE(_activityGroup) forKey:@"activityGroup"];
    [dict setObject:CHECKVALUE(_serviceTypeName) forKey:@"serviceTypeName"];
    
    [dict setObject:CHECKVALUE(_isAttend) forKey:@"isAttend"];
    [dict setObject:CHECKVALUE(_activityCycle) forKey:@"activityCycle"];
    [dict setObject:CHECKVALUE(_version) forKey:@"version"];
    [dict setObject:CHECKVALUE(_pic1) forKey:@"pic1"];

    [dict setObject:CHECKVALUE(_contact) forKey:@"contact"];
    [dict setObject:CHECKVALUE(_contactIcon) forKey:@"contactIcon"];
    [dict setObject:CHECKVALUE(_personNum) forKey:@"personNum"];
    [dict setObject:CHECKVALUE(_totalPersonNum) forKey:@"totalPersonNum"];
    [dict setObject:CHECKVALUE(_notifyBuildingIDList) forKey:@"notifyBuildingIDList"];

    return dict;
}

@end
